﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/revoelectric.master" title="Payments | Revo" CodeFile="Payments.aspx.cs" Inherits="Payments" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="head">
</asp:Content>

<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="widebarHeaderContentPlaceHolder">

</asp:Content>

<asp:Content runat="server" ID="home_menu" ContentPlaceHolderID="widebarBodyContentPlaceHolder">
    <form id="formPaymentsGrid" runat="server">
        <div>
	        <asp:GridView ID="GridViewPayments" runat="server" 
                AllowSorting="True" AutoGenerateColumns="False" DataSourceID="ccDb" 
                EnableModelValidation="True" BackColor="White" BorderColor="#999999" 
                BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" 
                AllowPaging="True" DataKeyNames="id" DataMember="DefaultView" 
                ShowFooter="True">
                <AlternatingRowStyle BackColor="#DCDCDC" />
                <Columns>
                    <asp:BoundField DataField="amount" HeaderText="Amount Paid" 
                        SortExpression="amount" />
                    <asp:BoundField DataField="method" HeaderText="Method" 
                        SortExpression="method" />
                    <asp:BoundField DataField="pay_date" HeaderText="Date Paid" 
                        SortExpression="pay_date" />
                    <asp:BoundField DataField="paid_by" HeaderText="Paid By" SortExpression="paid_by" />
                    <asp:BoundField DataField="meter_id" HeaderText="Meter Id" 
                        SortExpression="meter_id" />
                </Columns>
                <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            <asp:SqlDataSource ID="ccDb" runat="server" 
                ConnectionString="<%$ ConnectionStrings:onwindConnectionString %>" 
                SelectCommand="sp_getAllPayments" SelectCommandType="StoredProcedure"
                InsertCommand="sp_insertPayment" InsertCommandType="StoredProcedure">
            </asp:SqlDataSource>
        </div>
        <div>
                                
            <asp:FormView ID="FormViewPayment" runat="server" BackColor="White" 
                BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                DataSourceID="ccDb" EnableModelValidation="True" GridLines="Vertical" 
                DataKeyNames="id" DefaultMode="Insert">
                                    
                <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                <InsertItemTemplate>
                    <h3>Add New Payment</h3>
                    <span class="txtLabel">Amount:</span>
                    <asp:TextBox ID="amountTextBox" runat="server" 
                        Text='<%# Bind("amount") %>' />
                    <br />
                    <span class="txtLabel">Method:</span>
                    <asp:DropDownList ID="DropDownList2" runat="server" Text='<%# Bind("method") %>'>
                        <asp:ListItem Value="cash">Cash</asp:ListItem>
                        <asp:ListItem Value="ccard">Credit Card</asp:ListItem>
                    </asp:DropDownList>
                    <br />
                    <span class="txtLabel">Paid By:</span>
                    <asp:TextBox ID="paid_byTextBox" runat="server" 
                        Text='<%# Bind("paid_by") %>' />
                    <br />
                    <span class="txtLabel">Meter Id:</span>
                    <asp:TextBox ID="txtLabel" runat="server" DataSourceID="ccDbx" Text='<%# Bind("meter_id") %>'>
                    </asp:TextBox>
                    <asp:SqlDataSource ID="ccDbx" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:onwindConnectionString %>" 
                        SelectCommand="SELECT [id], [cycle_start], [cycle_end], [consumption], [due_date], [current_charge], [previous_balance], [total_charge], [meter_id] FROM [billing]">
                    </asp:SqlDataSource>
                                                        <br />
                    <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                        CommandName="Insert" Text="Insert" />
                    &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                        CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                </InsertItemTemplate>
            </asp:FormView>  
        </div>
    </form>
</asp:Content>

